<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.14"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>spi: xspi_low_level_example.c File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="HTML_custom.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="xlogo_bg.gif"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">spi
   </div>
   <div id="projectbrief">Xilinx SDK Drivers API Documentation</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.14 -->
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',false,false,'search.php','Search');
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('xspi__low__level__example_8c.html','');});
</script>
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">xspi_low_level_example.c File Reference</div>  </div>
</div><!--header-->
<div class="contents">
<a name="details" id="details"></a><h2 class="groupheader">Overview</h2>
<div class="textblock"><p>This file contains a design example using the low-level driver of the SPI driver (<a class="el" href="struct_x_spi.html" title="The XSpi driver instance data. ">XSpi</a>). </p>
<p>These macros are found in <a class="el" href="xspi__l_8h.html">xspi_l.h</a>. A simple loopback test is done within an SPI device in polled mode. This example works only with 8-bit wide data transfers.</p>
<dl class="section note"><dt>Note</dt><dd>This example works only with 8-bit wide data transfers in standard SPI mode. This example will not work if the axi_qspi device is confiured in dual/quad modes.</dd></dl>
<p>To make this example work for 16 bit transfers change u8 Buffer[BUFFER_SIZE] to u16 Buffer[BUFFER_SIZE]. The SPI Core should aslo be configured for 16 bit access during the build time.</p>
<p>To make this example work for 32 bit transfers change u8 Buffer[BUFFER_SIZE] to u32 Buffer[BUFFER_SIZE]. The SPI Core should aslo be configured for 32 bit access during the build time.</p>
<pre>
  MODIFICATION HISTORY:</pre><pre>  Ver   Who  Date     Changes
<hr/>

  1.00b rpm  04/24/02 First release
  1.00b jhl  09/10/02 Added code to ensure it works with a fast processor.
  1.00b sv   05/16/05 Minor changes to comply to Doxygen and coding guidelines
  3.00a ktn  10/28/09 Converted all register accesses to 32 bit access.
  3.02a sdm  05/04/11 Added a note about dual/quad modes in axi_qspi.
  4.2   ms   01/23/17 Added xil_printf statement in main function to
                      ensure that "Successfully ran" and "Failed" strings
                      are available in all examples. This is a fix for
                      CR-965028.</pre><pre>*</pre> </div><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a84062f5eec2674a89353f5679b0928a2"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xspi__low__level__example_8c.html#a84062f5eec2674a89353f5679b0928a2">XSpi_LowLevelExample</a> (u32 BaseAddress)</td></tr>
<tr class="memdesc:a84062f5eec2674a89353f5679b0928a2"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function does a simple loopback test within an SPI device.  <a href="#a84062f5eec2674a89353f5679b0928a2">More...</a><br /></td></tr>
<tr class="separator:a84062f5eec2674a89353f5679b0928a2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a840291bc02cba5474a4cb46a9b9566fe"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xspi__low__level__example_8c.html#a840291bc02cba5474a4cb46a9b9566fe">main</a> (void)</td></tr>
<tr class="memdesc:a840291bc02cba5474a4cb46a9b9566fe"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function is the main function of the SPI Low Level example.  <a href="#a840291bc02cba5474a4cb46a9b9566fe">More...</a><br /></td></tr>
<tr class="separator:a840291bc02cba5474a4cb46a9b9566fe"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Function Documentation</h2>
<a id="a840291bc02cba5474a4cb46a9b9566fe"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a840291bc02cba5474a4cb46a9b9566fe">&#9670;&nbsp;</a></span>main()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int main </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function is the main function of the SPI Low Level example. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">None</td><td></td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>XST_SUCCESS to indicate success, else XST_FAILURE to indicate Failure.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>None </dd></dl>

<p class="reference">References <a class="el" href="xspi__low__level__example_8c.html#a84062f5eec2674a89353f5679b0928a2">XSpi_LowLevelExample()</a>.</p>

</div>
</div>
<a id="a84062f5eec2674a89353f5679b0928a2"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a84062f5eec2674a89353f5679b0928a2">&#9670;&nbsp;</a></span>XSpi_LowLevelExample()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int XSpi_LowLevelExample </td>
          <td>(</td>
          <td class="paramtype">u32&#160;</td>
          <td class="paramname"><em>BaseAddress</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function does a simple loopback test within an SPI device. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">BaseAddress</td><td>is the BaseAddress of the SPI device</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>XST_SUCCESS if successful, XST_FAILURE if unsuccessful</dd></dl>
<dl class="section note"><dt>Note</dt><dd>None </dd></dl>

<p class="reference">References <a class="el" href="group__spi__v4__1.html#ga6a060df48208ca7e56572762233ceadb">XSP_CR_LOOPBACK_MASK</a>, <a class="el" href="group__spi__v4__1.html#ga25aabcaa1db090de7cf4aaf3cb05ea6b">XSP_CR_MASTER_MODE_MASK</a>, <a class="el" href="group__spi__v4__1.html#ga3a63aa98328d40e3221901143e128da1">XSP_CR_OFFSET</a>, <a class="el" href="group__spi__v4__1.html#ga5e55891344ab473841b6eefc2bda35a2">XSpi_ReadReg</a>, and <a class="el" href="group__spi__v4__1.html#ga32e741800118678aa060ef2a13661e31">XSpi_WriteReg</a>.</p>

<p class="reference">Referenced by <a class="el" href="xspi__low__level__example_8c.html#a840291bc02cba5474a4cb46a9b9566fe">main()</a>.</p>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="footer">Copyright &copy; 2015 Xilinx Inc. All rights reserved.</li>
  </ul>
</div>
</body>
</html>
